#include <stdio.h>
#include <stdlib.h>

struct node {
	int data;
	struct node *next;
};

void freeList(struct node *head) {
	struct node *temp;
	while (head != NULL) {
		temp = head;
		head = head->next;
		free(temp);
	}
}

int main() {
	struct node *head = NULL, *q = NULL;
	int n, len = 0, num[99], i = 0;
	while (scanf("%d", &n) != EOF) {
		num[i] = n;
		q = (struct node *)malloc(sizeof(struct node));
		if (q == NULL) {
			fprintf(stderr, "Memory allocation failed\n");
			freeList(head);
			return 1;
		}
		q->data = n;
		q->next = head;
		head = q;
		len++;
		i++;
	}
	for (i = len - 1; i >= 0; i--) {
		printf("%d ", num[i]);
	}

	return 0;
}
